<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">

<head>
  <title>
    <!--升舱列表-->
  </title>
  <meta charset="utf-8">
  <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  <link rel="stylesheet" href="css/project/ui-input-v3.css">
  <link rel="stylesheet" href="css/ui-base.css">
  <link rel="stylesheet" href="css/ui-box.css">
  <link rel="stylesheet" href="css/project/style.css">
  <link rel="stylesheet" href="css/zv_common.css">
  <link rel="stylesheet" href="css/project/ui-color-v3.css">
  <link rel="stylesheet" href="css/project/ui-res-v3.css">
  <link rel="stylesheet" href="css/iBox.css?v=202022">
  <link rel="stylesheet" href="css/base.css">
  <style> 
       #condition{
        position: fixed;
        left:0;
        top:0;
        z-index: 20;
    }
    #candidates{
      position: absolute;
      top:0;
      left:0;
      width:100%;
    }
 

    .datecolor {
      color: #525252;

    }

    .b-norarea {
      border-color: #ccc;
    }

    .passenger_infoborder {
      border-bottom: 1px solid #e5e5e5;
    }

    .passenger_infoborderb {
      border: 0px;
    }

    .line-h {
      padding: 0.1em 0.3em 0.1em 0.3em;
      border-bottom: solid #cccccc 1px;
    }

    .line-h1 {
      padding: 0em 0.3em 0em 0.3em;
    }

    .umwh {
      min-width: 1.5em;
      min-height: 1.5em;
    }

    .trf {
      transform: rotate(180deg);
    }
  </style>
  <script src="js/zy_control.js"></script>
  <script src="js/zy_click.js"></script>
  <script src="js/jquery-3.1.1.min.js?v=202021"></script>
  <script src="js/main.js"></script>
  <script src="js/init.js"></script>
  <script src="js/iBox.js?v=202022"></script>
  <script src="js/common.js"></script>
  <script src="js/appcan.min.js"></script>
  <script src="js/candidate.js"></script>
  <script src="js/stringUtils.js"></script>
  <script src="js/dateUtils.js"></script>
  <script src="js/genTransSerialUtils.js"></script>
  <script src="js/talkingdata.js"></script>
  <script src="js/common.js"></script>
</head>
<body class="um-vp" ontouchstart style="background:#FFFFFF">
  <div id="page_1" class="ub ub-ver um-vp" style="height:100%;width:100%">
    <div id="condition">
      <div class="line-h c-wh">
        <div class="ub t-bla ub-ac">
          <div class=" ub-ac ulev0 datecolor ufl pt1">承运人:</span>
          </div>
          <div class="ub-f1 ub uba  b-gra  sel noboder" style="width:45%">
            <div class="ub-f1 ut-s uinn tx-l t-gra ulh-sel po" id="carrier">MU</div>
            <div class="b-gra  umw2 ub ub-pc ub-ac">
              <div class="ub-img umw1 umh1 res3"></div>
            </div>
            <select name="Carrier" selectedindex="0" id="Carrier" onchange="zy_selectmenu(this.id)">
                            <option value="MU">MU</option>
                            <option value="FM">FM</option>
                            <option value="KN">KN</option>
                     </select>
          </div>

          <div class='ub b-norarea c-wh' style="width:55%">
            <div class=" ub-ac ulev0 datecolor ufl pt4">航班号:</span>
            </div>
            <div class="ub ub-f1  ">
              <div class="uba uinput passenger_infoborderb" style="width:100%">
                <input placeholder="请输入航班号" type="tel" id="flightNo" style="width:100%" value="">
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="line-h c-wh">
        <div class="ub t-bla ub-ac">
          <div class='ub b-norarea c-wh' style="width:55%">
            <div class=" ub-ac ulev0 datecolor umw4 pt2">航班日期:</div>
            <div class="ub ub-f1">
              <div class="uba uinput passenger_infoborderb po" id="flightDate" style="width:98%; line-height:1.7em" onclick="checked_day('flightDate')">请选择日期</div>
            </div>
          </div>
          <div class='ub b-norarea c-wh' style="width:45%">
            <div class=" ub-ac ulev0 datecolor umw4 pt2">是否值机:</div>
            <div class="ub-f1 ub uba  b-gra  sel noboder">
              <div class="ub-f1 ut-s tx-l t-gra ulh-sel po" id="CheckinStatus" style="width:100%; line-height:1.7em">全部</div>
              <div class="b-gra ub ub-pc ub-ac">
                <div class="ub-img umw1 umh1 res3"></div>
              </div>
              <select name="chekStatus" selectedindex="0" id="checkinStatus" onchange="zy_selectmenu(this.id)">
                            <option value="">全部</option>
                            <option value="AC">已值机</option>
                            <option value="NA">未值机</option>
                     </select>
            </div>
          </div>
        </div>
      </div>


      <div class="line-h c-wh">
        <div class="ub t-bla ub-ac">
          <div class='ub b-norarea c-wh' style="width:50%">
            <div class=" ub-ac ulev0 datecolor umw4 pt4">出发机场:</div>
            <div class="ub ub-f1  ">
              <div class="uba uinput passenger_infoborderb" style="width:100%">
                <input placeholder="SHA" type="text" id="oriEng" style="width:100%" value="">
              </div>
            </div>
          </div>
          <div class='ub b-norarea c-wh' style="width:50%">
            <div class=" ub-ac ulev0 datecolor umw4 pt4">到达机场:</div>
            <div class="ub ub-f1  ">
              <div class="uba uinput passenger_infoborderb" style="width:100%">
                <input placeholder="PEK" type="text" id="desEng" style="width:100%" value="">
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="line-h1 c-wh">
        <div class="ub-f1 ub uba  b-gra  sel noboder">
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="Y" id="cabin_Y">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">经济舱</div>
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="W" id="cabin_W">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">超级经济舱</div>
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="J" id="cabin_J" checked="checked">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">公务舱</div>
        </div>
      </div>

      <div class="line-h1  c-wh">
        <div class="ub-f1 ub uba  b-gra  sel noboder">
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="F" id="cabin_F">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">头等舱</div>
          <!--复选框开始-->
          <input type="checkbox" name="che1" class="uhide" value="U" id="cabin_U">
          <div onclick="zy_for(event)" ontouchstart="zy_touch('btn-act')" class="ub uc-a1 t-bla">
            <div class="che-icon ub-img umwh"></div>
          </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l ulh-sel">豪华头等舱 </div>
          <!--复选框结束-->
          <div class="ub-f1 ut-s uinn tx-l t-gra ulh-sel">&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </div>
        </div>
      </div>
    </div>
    <form action="javascript:;" method="get" id="search_form" name="search_form">

      <div class="ub ub-ver" style="clear:both;">

      </div>
    </form>
    <!---查询列表显示-->
    <div id="candidates">
    
    </div>
  </div>
  <div id="footer" ontouchstart="zy_touch('btn-act')" onclick="Points()" style="position:fixed; width:100%;bottom:0;" class="t-wh c-blu1 tx-c umh4 uhide" ontouchmove="return false;">
    确 定(<span id="checknum">0</span>)
  </div>
  <script>
    zy_init();
    //var path = "http://127.0.01:8080/LvKeJiaZhi/";
    //var path = 'http://172.31.64.34:8011/sdk10098/public/LKJZ/';
     //var path = "http://store.ceair.com/mas/sdk10098/public/yddfMAS/";
    var path= h_yddfUrl+"yddfMAS/";
    var candidateList = '';
    window.uexOnload = function(type) {
      if (!type) {
        //exitKeyPressedListener();
        $$("flightDate").innerHTML = getNowFormatDate().substr(0,11);
        IC.talkingDataCount("机场降舱", "0002");
    }
  }
    /**
     * 获取升舱列表
     */
    var imei = '';
    var CarrierD, flightNoD, flightDateD, oriEngD, desEngD, SubClasslv, CheckinStatus, userId,transSerialNo,transTime;
    function CandidateUpgrade(){
      IC.talkingDataCount("机场降舱", "0002");
      candidateList = '';
      reset(0);
      $("#candidates").empty();
      var url = path + "downgrade";
      userId = localStorage['MU30-lOGIN-USRNAME'];
      //userId = "zhaozhentao";
      CarrierD = $$("Carrier").value; /*承运人*/
      flightNoD = $$("flightNo").value; /*航班号*/
      flightDateD = $$("flightDate").innerHTML.replace(/\s+/g,"");
      oriEngD1 = $$("oriEng").value==""?"SHA":$$("oriEng").value; /*出发机场3字码*/
      oriEngD = oriEngD1.toUpperCase();
      desEngD1 = $$("desEng").value==""?"PEK":$$("desEng").value; /*到达机场3字码*/
      desEngD = desEngD1.toUpperCase();
      imei = getDevice() == "" ? "340403199003170612" : getDevice();
      transTime = new Date().formatDate("yyyy-MM-dd HH:mm:ss");
      transSerialNo = GenTransSerialUtils.genTransSerialNo("1070");
      CheckinStatus = $$("checkinStatus").value;
      var arr=['cabin_Y','cabin_U','cabin_J','cabin_W','cabin_F'];
      SubClasslv=judgeChecked(arr);
      //  flightNoD='5107';
      if (flightNoD == ''){
        $alert("航班号不能为空！");
        return;
      }

      //var data = "transReqPkg={'busData':{'carrier':'MU','carrierType':'','checkinStatus':'','depDt':'2017-04-01','desEng':'PEK','flightNo':'5111','fltEvtSts':'','oriEng':'SHA','pnrRankType':0,'subCbn':'','subclassLv':'U,F,C,J,W,Y'},'pkgHeader':{'systemId':'1070','transSerialNo':'11070001020170401104520421626563','transTime':'2017-04-01 10:45:20','transType':'downgrade'},'transUser':{'transUserId':'zhaozhentao'}}" ;
      var data = {
        "carrier": CarrierD,
        "depDt": flightDateD,
        "desEng": desEngD,
        "flightNo": flightNoD,
        "oriEng": oriEngD,
        "pnrRankType": '0',
        "subclassLv": SubClasslv,
        "systemId": '1070',
        "transSerialNo": transSerialNo,
        "transTime": transTime,
        "transType": 'downgrade',
        "transUserId": userId,
        "checkinStatus": CheckinStatus,
        "carrierType": '',
        "fltEvtSts": '',
        "subCbn": ''
      };
     //alert(JSON.stringify(data));
      $.iBoxWait();
      $.ajax({
        type: "POST",
        url: url,
        data:data,
        dataType: "JSON", //"xml", "html", "script", "json", "jsonp", "text".
        success: function(data) {

          $.iBoxHide();
          //console.log(data);

          if (data.busData) {
            if (data.busData.length) {

              LayOutList(data.busData);
            }
          } else {
            $alert('暂无数据');
          }
        },
        //调用出错执行的函数
        error: function(err) {
          $.iBoxHide();
          $alert("暂无相关信息！");
        }
      });
    }

    var paxname = ''; //旅客姓名
    var vip = ''; //VIP
    var subCbn = ''; //子舱位
    var mcv = ''; //MCV
    var sri = ''; //SRI
    var idNum = ''; //证件号码
    var idCard = ''; //证件号码显示全部
    var rankVal = ''; //级别
    var ffpLevel = ''; //金卡银卡
    var orderGrade = ''; //旅客排序

    var checkBoxArr = [];
    var checkItemArr = [];
    var rcdStr2 = {};
    var rcdStr3 = {};
    var checkNum = 0;

    function LayOutList(dt) {
      checkItemArr = [];
      IC.talkingDataCount("机场降舱", "0002");

      dt.forEach(function(item) {
        var rcdStr1 = {};
        rcdStr1.carrier = CarrierD;
        rcdStr1.depDt = flightDateD;
        rcdStr1.desEng = desEngD;
        rcdStr1.eventCode = 'FLTDWG_001';
        rcdStr1.eventDesc = '';
        rcdStr1.flightNo = flightNoD;
        rcdStr1.oriEng = oriEngD;
        rcdStr1.subclass = SubClasslv;
        rcdStr1.idNum = item.idNum;
        rcdStr1.idType = item.idType;
        rcdStr1.paxName = item.paxName;

        checkItemArr.push(rcdStr1);
        idNum = IdShowHandler(item.idNum);
        var rcdStr = item.idNum + "|" + paxname;
        if (ffpLevel == '普通卡') {
          ffpLevel = '普卡';
        }
        //常客登机未空是不显示
        if (ffpLevel == '') {
          candidateSubList = '<div class="uba umar-a cbg ub ub-ac" >\
            <div class="candidates " style="width:80%;" onclick="DetailPage(\'' + item.paxName + '\',\'' + idNum + '\',\'' + item.mcvVal + '\',\'' + item.sriVal +
            '\')">\
            <div class="ctxt"><div class="box"><span class="ctxtsp">姓名：</span>' + item.paxName + '</div><div class="box"><span class="ctxtsp">旅客排序：</span>' + item.orderGrade +
            '</div></div>\
            <div class="ctxt"><div class="box"><span class="ctxtsp">子舱位：</span>' + item.subCbn + '</div><div class="box"><span class="ctxtsp">常客等级：</span>' + item.ffpLevel +
            '</div></div>\
            </div>\
            <div class="ub ub-ac">\
            <div class="ub ub uncheck trf" id="checkbox_' + rcdStr + '" onclick="checkIconClick(\'' + rcdStr +
            '\')" value="Click checkbox" value="uncheck"/></div>\
            </div>\
            </div>';

        } else {
          if(ffpLevel=="null"||ffpLevel==null){
            ffpLevel="";
          }
          candidateSubList = '<div class="uba umar-a cbg ub ub-ac" >\
            <div class="candidates " style="width:80%;" onclick="DetailPage(\'' + item.paxName + '\',\'' + idNum + '\',\'' + item.mcvVal + '\',\'' + item.sriVal +
            '\')">\
            <div class="ctxt"><div class="box"><span class="ctxtsp">姓名：</span>' + item.paxname + '</div><div class="box"><span class="ctxtsp">旅客排序：</span>' + item.orderGrade +
            '</div></div>\
            <div class="ctxt"><div class="box"><span class="ctxtsp">子舱位：</span>' + item.subCbn + '</div><div class="box"><span class="ctxtsp">常客等级：</span>' + ffpLevel +
            '</div></div>\
            </div>\
            <div class="ub ub-ac">\
            <div class="ub ub uncheck trf" id="checkbox_' + rcdStr + '" onclick="checkIconClick(\'' + rcdStr +
            '\')" value="Click checkbox" value="uncheck"/></div>\
            </div>\
            </div>';
        }
        candidateList += candidateSubList;

        checkBoxArr.push(rcdStr);
        idCard = item.idNum;

      });

      $$("candidates").innerHTML = candidateList;
       var high=$("#page_1").height();
      var top=$("#condition").height();
      var top2=high-top;//页面加载列表 可滚动的高度;
        $("#candidates").css({
        "top":top,
        "left":"0",
        "height":top2,
         "overflow-y":"scroll",
        "-webkit-overflow-scrolling": "touch",
     })
    }

    function checkIconClick(rcdStr) {
      IC.talkingDataCount("机场降舱", "0002");
      if ($$("checkbox_" + rcdStr).value == "check") {
        checkNum--;
        $$("checkbox_" + rcdStr).value = "uncheck";
        $$("checkbox_" + rcdStr).className = "ub ub uncheck trf";
      } else {
        checkNum++;
        $$("checkbox_" + rcdStr).value = "check";
        $$("checkbox_" + rcdStr).className = "ub ub check trf";

      }
      $$("checknum").innerHTML = checkNum;
      //  alert(checkNum)
      if (checkNum < 1) {
        $$("footer").className = "t-wh c-blu1 tx-c umh4 uhide";
      } else {
        $$("footer").className = "t-wh c-blu1 tx-c umh4";
      }
    }
    /**
     * num:0为重新请求数据 1为选中提交候补确定按钮
     * @param {Object} num
     */
    function reset(num) {
      IC.talkingDataCount("机场降舱", "0002");
      if (num == 0) {
        checkBoxArr.length = 0;
      }
      checkNum = 0;
      $$("footer").className = "t-wh c-blu1 tx-c umh4 uhide";
      var len = checkBoxArr.length;
      for (var i = 0; i < len; i++) {
        $$("checkbox_" + checkBoxArr[i]).value = "uncheck";
        $$("checkbox_" + checkBoxArr[i]).className = "ub ub uncheck";
      }
    }

    function checkBoxStatus(rcdStr2, rcdStr3) {
      IC.talkingDataCount("机场降舱", "0002");
      var tempObj = {};
      tempObj["busData"] = [];
      tempObj["pkgHeader"] = {};
      tempObj["transUser"] = {};
      var transReqPkg = {};
      var len = checkBoxArr.length;
      for (var i = 0; i < len; i++) {
        if ($$("checkbox_" + checkBoxArr[i]).value == "check") {
          var obj = checkItemArr[i];
          obj.transGuid = GenTransSerialUtils.genTransSerialNo("1070");
          tempObj["busData"].push(obj);

        }
        tempObj["pkgHeader"] = rcdStr2;
        tempObj["transUser"] = rcdStr3;
        transReqPkg = tempObj;
      }
      return transReqPkg;
    }

    function DetailPage(paxname, idNum, mcv, sri) {
      //alert('123');
      IC.talkingDataCount("机场降舱", "0002");
      setStorage("candiateDowngrades_paxname", paxname);
      setStorage("candiateDowngrades_idNum", idNum);
      setStorage("candiateDowngrades_mcv", mcv);
      setStorage("candiateDowngrades_sri", sri);
      setStorage("candiateDowngrades_downgrades", 'd');
      openNewWin('candidateDV_ListDetail', 'candidateDV_ListDetail.html');
    }

    function Points() {
      IC.talkingDataCount("机场降舱", "0002");
      rcdStr2.systemId = "1070";
      rcdStr2.transSerialNo = GenTransSerialUtils.genTransSerialNo("1070");
      rcdStr2.transTime = new Date().formatDate("yyyy-MM-dd HH:mm:ss");
      rcdStr2.transType = "arpupg";
      rcdStr3.transUserId = userId;
      var url = path + "calcPaxSriInfos";
      var transReqPkg = checkBoxStatus(rcdStr2, rcdStr3);
      var data = {
        "transReqPkg": JSON.stringify(transReqPkg)
      };
      //console.log(JSON.stringify(data));
      // console.log(transReqPkg);
      $.iBoxWait();
      $.ajax({
        type: "POST",
        url: url,
        data: data,
        datatype: "JSON", //"xml", "html", "script", "json", "jsonp", "text".
        success: function(json) {
          $.iBoxHide();
          //console.log(json);
          reset(1);
        },
        //调用出错执行的函数
        error: function(err) {
          $.iBoxHide();
          $alert("查询条件错误！");
        }
      });
    }
  

 
  </script>
</body>

</html>
